package jin.si.controller;

import com.lly835.bestpay.config.WxPayConfig;
import com.lly835.bestpay.enums.BestPayTypeEnum;
import com.lly835.bestpay.model.PayRequest;
import com.lly835.bestpay.model.PayResponse;
import com.lly835.bestpay.service.impl.BestPayServiceImpl;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * ClassName:WxPayApi
 * Package:jin.si.controller
 * Description:
 *
 * @Date:2022/4/21 16:57
 * @Author: XJR
 */
@RequestMapping("/qfw/pay")
public class WxPayApi {
    /*@PostMapping("/wxpay")
    public PayResponse wxpay(@RequestBody PayOrder payOrder){
        System.out.println(payOrder);
        //微信公众账号支付配置
        WxPayConfig wxPayConfig = new WxPayConfig();
        wxPayConfig.setMiniAppId("你的小程序ID");
        //wxPayConfig.setAppSecret("");
        wxPayConfig.setMchId("商户ID");
        wxPayConfig.setMchKey("商户支付KEY");
        wxPayConfig.setNotifyUrl("回调地址");
        BestPayServiceImpl bestPayService = new BestPayServiceImpl();
        bestPayService.setWxPayConfig(wxPayConfig);
        //发起支付
        PayRequest payRequest = new PayRequest();
        payRequest.setPayTypeEnum(BestPayTypeEnum.WXPAY_MINI);
        //订单信息
        payRequest.setOrderId(payOrder.getOrderId());//你的订单号
        payRequest.setOrderName("支付信息");
        payRequest.setOrderAmount(payOrder.getPrice());//订单价格
        payRequest.setOpenid(payOrder.getOpenId());//openid

        PayResponse payResponse =  bestPayService.pay(payRequest);
        System.out.println(payResponse);
        return payResponse;
    }*/
}
